<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    240. Search a 2D Matrix II
   </h1>
   <p>
    Write an efficient algorithm that searches for a value in an
    <i>
     m
    </i>
    x
    <i>
     n
    </i>
    matrix. This matrix has the following properties:
   </p>
   <ul>
    <li>
     Integers in each row are sorted in ascending from left to right.
    </li>
    <li>
     Integers in each column are sorted in ascending from top to bottom.
    </li>
   </ul>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <p>
    Consider the following matrix:
   </p>
   <pre>
[
  [1,   4,  7, 11, 15],
  [2,   5,  8, 12, 19],
  [3,   6,  9, 16, 22],
  [10, 13, 14, 17, 24],
  [18, 21, 23, 26, 30]
]
</pre>
   <p>
    Given&nbsp;target&nbsp;=&nbsp;
    <code>
     5
    </code>
    , return&nbsp;
    <code>
     true
    </code>
    .
   </p>
   <p>
    Given&nbsp;target&nbsp;=&nbsp;
    <code>
     20
    </code>
    , return&nbsp;
    <code>
     false
    </code>
    .
   </p>
  </div>
  <div>
   <h1 class="question_title">
    240. 搜索二维矩阵 II
   </h1>
   <p>
    编写一个高效的算法来搜索&nbsp;
    <em>
     m
    </em>
    &nbsp;x&nbsp;
    <em>
     n
    </em>
    &nbsp;矩阵 matrix 中的一个目标值 target。该矩阵具有以下特性：
   </p>
   <ul>
    <li>
     每行的元素从左到右升序排列。
    </li>
    <li>
     每列的元素从上到下升序排列。
    </li>
   </ul>
   <p>
    <strong>
     示例:
    </strong>
   </p>
   <p>
    现有矩阵 matrix 如下：
   </p>
   <pre>[
  [1,   4,  7, 11, 15],
  [2,   5,  8, 12, 19],
  [3,   6,  9, 16, 22],
  [10, 13, 14, 17, 24],
  [18, 21, 23, 26, 30]
]
</pre>
   <p>
    给定 target&nbsp;=&nbsp;
    <code>
     5
    </code>
    ，返回&nbsp;
    <code>
     true
    </code>
    。
   </p>
   <p>
    给定&nbsp;target&nbsp;=&nbsp;
    <code>
     20
    </code>
    ，返回&nbsp;
    <code>
     false
    </code>
    。
   </p>
  </div>
 </body>
</html>